﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace HeadFirst.SimpleFactory
{
    public class BaseOperation
    {
        public float FirstParams
        {
            get;set;
        }
        public float SecondParams
        {
            get;set;
        }
        public virtual float Operation()
        {
            return 0;
        }
    }
    public class MultiOperation : BaseOperation
    {
        public override float Operation()
        {
            return FirstParams * SecondParams;
        }
    }
    public class DivisionOperation : BaseOperation
    {
        public override float Operation()
        {
            if (SecondParams != 0)
                return FirstParams / SecondParams;
            else
            {
                return float.NaN;
            }
        }
    }
    public class AddOperation : BaseOperation
    {
        public override float Operation()
        {
            return FirstParams + SecondParams;
        }
    }
    public class SubOperation : BaseOperation
    {
        public override float Operation()
        {
            return FirstParams - SecondParams;
        }
    }
    public class NoneOperation:BaseOperation
    {
        public override float Operation()
        {
            return float.NaN;
        }
    }
}
